Configuring: SQL Expression

Select one or more fields to be filtered using a WHERE clause, which defines the conditions to be used for filtering. The resulting dataset will only contain these selected fields, with values that meet the stipulated conditions. These fields can also be sorted by selecting the most important field for investigation, and sorting into ascending or descending order.

Worked example: SQL expression

Steps to configure

  1. Select field: Select any of the available fields for filtering.

  2. Enter filter: Enter the WHERE clause, defining the conditions to be met for filtering.

  3. Order fields: Select the field/s and ordering method to be used.

  4. Execute: A new dataset is created, containing the filtered and ordered fields.

Step 1: Select field

Select the fields you would like filter. The resulting dataset will only contain these fields.

  • Default: all fields are placed in the available column.

  • Minimum configuration: at least one field must be selected.

Step 2: Enter filter

Enter the WHERE clause to be used for filtering. The WHERE clause will define conditions that need to be met in order for the values to be included in the new dataset. This clause must contain one or more Boolean expressions, which can be combined using the logical operators: and, or, and not.

  • The fields selected will be listed in the uppermost window. All the fields listed will be included in the new dataset, provided they comply to the WHERE clause conditions.

  • You can use any field/s in the dataset for your WHERE query. These fields are listed in the window next to the WHERE query text box.

  • To write the Boolean WHERE expression, select the field using the [<] key, supply a Boolean operator, and list a condition. Check the syntax of the expression using the [green check] button. The output of the expression will be listed in the window below.

  • The operation can only be executed if the syntax is ok. If the syntax is not correct, the [Next] and [Finish] buttons will be disabled. If the syntax is incorrect, an error message will be shown in the Output window.

  • Once you are satisfied that the expressions listed satisfy all the WHERE conditions required, select [Next] to continue configuration by ordering the fields, or [Finish] to create the new dataset.

  • Default: a blank query text box.

  • Minimum configuration: the user must define a valid filter query.

SQL query:

For every filter field that is entered by the user, this query will be used:

CREATE TABLE

                 [CreateTableName] ([ColumnName] dataType, ...)

INSERT INTO

                 [CreateTableName]

SELECT

                 [Select Clause]

FROM

                [OriginalTableName]

WHERE

                [Where Clause]

Step 3: Order fields

Select the field/s that will determine the prioritization of how the results are sorted.

  • This is an optional step.

  • Highlight the selected field and move the fields up or down to specify the prioritizing of the field.  

  • Sort these fields in ascending or descending order.

  • Default: all fields are placed in the available window.

Step 4: Execute

A new dataset will be created, containing the filtered fields which are sorted according to the specified order. The original dataset is not affected in any way.


Related topics:

  

CSense 2023- Last updated: June 24,2025